import { ElMessage, ElNotification, ElMessageBox } from 'element-plus'

// message：消息内容，type：消息类型，timer：弹窗停留时间
export const popUpMsg = (type: any, message: string, timer: number) => {
	return ElMessage({
		message,
		type,
		duration: timer
	})
}

// message：消息内容，type：消息类型，title：弹窗标题，timer：弹窗停留时间
export const notifyPopUpMsg = (type: any, message: string, title: string, timer: number) => {
	return ElNotification({
		title,
		message,
		type,
		duration: timer
	})
}

// 询问弹窗
export const confirmPopUpMsg = (
	type: any,
	message: string,
	title: string,
	success: any,
	error: any,
	confirmText?: string,
	cancelText?: string
) => {
	return ElMessageBox.confirm(message, title, {
		confirmButtonText: confirmText ? confirmText : '确定',
		cancelButtonText: cancelText ? cancelText : '取消',
		type
	})
		.then(success)
		.catch(error)
}
